package cur.nature.framework.mvc.tree;

import lombok.Data;

import java.util.List;

@Data
public class TreeNode {
    private String id;

    private String parentId;
    private String text;
    private String nodeType;
    private boolean check;
    private boolean isLeaf = false;
    private List<TreeNode> children;
    private Object data;

    private Meta meta = new Meta("iconfont icon-xitongshezhi");

    @Data
    public static class Meta {
        private String icon;
        private String title;

        private String isLink;
        private boolean isHide = false;
        private boolean isKeepAlive = true;
        private boolean isAffix = false;
        private boolean isIframe = false;

        public Meta(String icon) {
            this.icon = icon;
        }
    }
    public TreeNode() {
    }

    public TreeNode(String id, String parentId, String text, Object data) {
        this.id = id;
        this.parentId = parentId;
        this.text = text;
        this.data = data;
    }

    public TreeNode(String id, String text, Object data) {
        this.id = id;
        this.text = text;
        this.data = data;
    }

    public TreeNode(String id, String text) {
        this.id = id;
        this.text = text;
    }
    public TreeNode(String id, String text, String nodeType) {
        this.id = id;
        this.text = text;
        this.nodeType = nodeType;
    }

    public TreeNode(String id,String parentId, String text, String nodeType) {
        this.id = id;
        this.parentId = parentId;
        this.text = text;
        this.nodeType = nodeType;
    }
}
